﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Crm.Sdk;
using Microsoft.Xrm.Sdk;

namespace XrmLibrary.MsCrm4Adapter.Extensions
{
    public static class EntityCollectionExtensions
    {
        public static IEnumerable<DynamicEntity> ToDynamicEntitySet(this EntityCollection entityCollection)
        {
            foreach(Entity entity in entityCollection.Entities)
            {
                DynamicEntity dynamicEntity = entity.ToDynamicEntity();
                yield return dynamicEntity;
            }
        }
    }
}
